<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3c.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<h:title>Certificate Application</h:title>
</h:head>

<body>

	<h:form id="pageForm">

		<br></br>
		<br></br>

		<p:dataTable var="so" value="#{dtSslObjectView.sslObjects}"
			emptyMessage="Certificate list is empty." id="basicDT">
			<f:facet name="header">
            Certificate list
        </f:facet>

			<p:column headerText="Url">
				<h:outputText value="#{so.url}" />
			</p:column>

			<p:column headerText="Expiry">
				<h:outputText value="#{so.expiryString}" />
			</p:column>

			<p:column headerText="Last checked">
				<h:outputText value="#{so.lastCheckedString}" />
			</p:column>

			<p:column style="width:32px;text-align: center">
				<p:commandButton update=":pageForm:sslObjectDetail"
					oncomplete="PF('sslDialog').show()" icon="ui-icon-search"
					title="Details">
					<f:setPropertyActionListener value="#{so}"
						target="#{dtSslObjectView.selectedSslObject}" />
				</p:commandButton>
			</p:column>
		</p:dataTable>

		<br></br>

		<h:panelGrid columns="6" cellpadding="5">
			<h:outputLabel for="inputUrl" value="Url:" style="font-weight:bold" />
			<p:inputText id="inputUrl" value="#{dtSslObjectView.urlToTestOrAdd}" />

			<p:commandButton actionListener="#{dtSslObjectView.testButtonAction}"
				update=":pageForm:displayTest" value="Test" icon="ui-icon-check" />

			<p:commandButton actionListener="#{dtSslObjectView.addButtonAction}"
				value="Add" icon="ui-icon-check"
				update=":pageForm:basicDT :pageForm:displayTest :pageForm:inputUrl :pageForm:outputLongMessage" />

		</h:panelGrid>
		
		<h:panelGrid columns="2" cellpadding="5">
        	<h:outputText value="Message " style="font-weight:bold" />
			<h:outputText id="displayTest" value="#{dtSslObjectView.message}" />
    	</h:panelGrid>
    		
		<h:panelGrid columns="2" cellpadding="5" >
        	<h:outputText value="Long Message " style="font-weight:bold" />
        	<h:outputText id="outputLongMessage" value="#{dtSslObjectView.longMessage}" />
    	</h:panelGrid>

		<p:dialog header="Details" widgetVar="sslDialog" modal="true"
			showEffect="fade" hideEffect="fade" resizable="false">
			<p:outputPanel id="sslObjectDetail" style="text-align:center;">
				<p:panelGrid columns="2"
					rendered="#{not empty dtSslObjectView.selectedSslObject}"
					columnClasses="label,value">
					<f:facet name="header">
						<h:outputText value="SSL Info" />
					</f:facet>

					<h:outputText value="Url:" />
					<h:outputText value="#{dtSslObjectView.selectedSslObject.url}" />

					<h:outputText value="Expiry:" />
					<h:outputText value="#{dtSslObjectView.selectedSslObject.expiryString}" />

					<h:outputText value="Last checked:" />
					<h:outputText
						value="#{dtSslObjectView.selectedSslObject.lastCheckedString}" />
				</p:panelGrid>
			</p:outputPanel>
		</p:dialog>

	</h:form>
</body>
</html>